#!/bin/sh -e

ip=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^ip=' | cut -d = -f 2`
gw=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^gw=' | cut -d = -f 2`
nm=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^netmask=' | cut -d = -f 2`

if [ -n "$ip" ]; then
	echo
	echo "Configuring eth0 with $ip netmask $nm gw $gw (via /proc/cmdline)"
	ifconfig eth0 $ip netmask $netmask
	route add default gw $gw
fi

exit 0
